import { request, MyRequest } from '@/plugins'

export const getLeakManageList = <T = GetLeakManageListResponse>(params: GetLeakManageListParams) =>
  request<T>({ method: 'get', url: '/api/v1/vul/leak/manage/list', params })

export const getLeakManageDetail = <T = LeakDetail>(params: GetLeakDetailParams) =>
  MyRequest<T>({ method: 'get', url: '/api/v1/vul/leak/manage/detail', params })

export const updateLeakManage = <T>(data) => request<T>({ method: 'put', url: '/api/v1/vul/leak/manage/update', data })

export const getLeakAuditList = (params: GetLeakAuditListParams) =>
  request<GetLeakManageListResponse>({ method: 'get', url: '/api/v1/vul/leak/audit/list', params })

export const getLeakAuditDetail = (params: GetLeakDetailParams) =>
  MyRequest<LeakDetail>({ method: 'get', url: '/api/v1/vul/leak/audit/detail', params })

export const updateLeakAudit = (data: UpdateLeakParams) => MyRequest({ method: 'put', url: '/api/v1/vul/leak/audit/update', data })

export const submitLeakAudit = (data: SubmitLeakAuditParams) =>
  MyRequest({ method: 'post', url: '/api/v1/vul/leak/audit/submit', data })

export const getLeakMapping = () => MyRequest<MapResponse>({ method: 'get', url: '/api/v1/vul/leak/mapping/list' })
